package com.nowcoder;

import java.util.Scanner;

/**
 *计算24点是一种扑克牌益智游戏，随机抽出4张扑克牌，通过加(+)，减(-)，乘(*), 除(/)四种运算法则计算得到整数24
 */
public class PokerPoint24 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String line = in.nextLine();
        String[] ss = line.split(" ");
        String[] poker = {"", "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
        int[] nums = new int[4];
        for (int i = 0; i < ss.length; i++) {
            String s = ss[i];
            if ("joker".equals(s) || "JOKER".equals(s)) {
                System.out.println("ERROR");
                return;
            }
            switch (s) {
                case "J":
                    nums[i] = 11;
                    break;
                case "Q":
                    nums[i] = 12;
                    break;
                case "K":
                    nums[i] = 13;
                    break;
                case "A":
                    nums[i] = 1;
                    break;
                default:
                    nums[i] = Integer.parseInt(s);
            }
        }
        String[] op = {"+", "-", "*", "/"};
        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j < nums.length; j++) {
                for (int k = 0; k < nums.length; k++) {
                    for (int l = 0; l < nums.length; l++) {
                        if (i == j || i == k || i == l || j == k || j == l || k == l) {
                            continue;
                        }
                        int[] target = {nums[i], nums[j], nums[k], nums[l]};
                        for (int a = 0; a < op.length; a++) {
                            for (int b = 0; b < op.length; b++) {
                                for (int c = 0; c < op.length; c++) {
                                    String op1 = op[a];
                                    int result = compute(target[0], target[1], op1);
                                    String op2 = op[b];
                                    result = compute(result, target[2], op2);
                                    String op3 = op[c];
                                    result = compute(result, target[3], op3);
                                    if (result == 24) {
                                        System.out.println(poker[target[0]] + op1 + poker[target[1]] + op2 + poker[target[2]] + op3 + poker[target[3]]);
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        System.out.println("NONE");
    }
    public static int compute(int a, int b, String op) {
        switch (op) {
            case "+":
                return a + b;
            case "-":
                return a - b;
            case "*":
                return a * b;
            case "/":
                return a / b;
        }
        return -1;
    }
}
